<?php // This file is customized copy of securimage_show.php file

// Remove the "//" from the following line for debugging problems
// error_reporting(E_ALL); ini_set('display_errors', 1);
require_once dirname(__FILE__) . '/securimage/securimage.php';
require_once dirname(__FILE__) . '/inc/spip_launcher.php'; // Load SPIP Environment

$img = new securimage();

// Set namespace
if ($_REQUEST['namespace'])
    $img->namespace = $_REQUEST['namespace'];
         
//$img->ttf_file        = './Quiff.ttf';
$captcha_type = lire_config('securimage/captcha_type');
if ($captcha_type == 'SI_CAPTCHA_MATHEMATIC') $img->captcha_type = Securimage::SI_CAPTCHA_MATHEMATIC; // show a simple math problem instead of text

$case_sensitive = lire_config('securimage/case_sensitive');
if ($case_sensitive == 'true') $img->case_sensitive  = true; // true to use case sensitve codes - not recommended

$image_height = lire_config('securimage/image_height');
if ($image_height) $img->image_height = $image_height; // height in pixels of the image

$image_width = lire_config('securimage/image_width');
if ($image_width) $img->image_width = $image_width; // width in pixels of the image

$perturbation = lire_config('securimage/perturbation');
if ($perturbation or $perturbation==0) $img->perturbation    = $perturbation; // 1.0 = high distortion, higher numbers = more distortion

$image_bg_color = lire_config('securimage/image_bg_color');
if ($image_bg_color) $img->image_bg_color  = new Securimage_Color($image_bg_color);   // image background color

$text_color = lire_config('securimage/text_color');
if ($text_color) $img->text_color = new Securimage_Color($text_color);   // captcha text color

$num_lines = lire_config('securimage/num_lines');
if ($num_lines) $img->num_lines = $num_lines; // how many lines to draw over the image

$line_color = lire_config('securimage/line_color');
if ($line_color) $img->line_color = new Securimage_Color($line_color);   // color of lines over the image
//$img->image_type      = SI_IMAGE_JPEG;                     // render as a jpeg image
//$img->signature_color = new Securimage_Color(rand(0, 64),
//                                             rand(64, 128),
//                                             rand(128, 255));  // random signature color

// see securimage.php for more options that can be set

$code_length = lire_config('securimage/code_length');
if ($code_length) $img->code_length = $code_length;

$charset = lire_config('securimage/charset');
if ($charset) $img->charset = $charset;

$img->show();  // outputs the image and content headers to the browser
// alternate use: 
// $img->show('/path/to/background_image.jpg');
